package com.hjxr.quota.datasource.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hjxr.quota.datasource.domain.TablenameAlias;
import com.hjxr.quota.datasource.mapper.TablenameAliasMapper;
import com.hjxr.quota.datasource.service.TablenameAliasService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author: sun
 * @version 1.0
 * @since: 2020-08-16
 */
@Service("tablenameAliasSerive")
@Transactional(readOnly = true)
public class TablenameAliasServiceImpl extends ServiceImpl<TablenameAliasMapper, TablenameAlias> implements TablenameAliasService {
    @Resource
    private TablenameAliasMapper tablenameAliasMapper;

    @Override
    public int update(TablenameAlias tablenameAlias) {
        return tablenameAliasMapper.update(tablenameAlias);
    }

    @Override
    public List<TablenameAlias> selectByDatasourceId(Integer datasourceId) {
        return tablenameAliasMapper.selectByDatasourceId(datasourceId);
    }

    @Override
    public List<TablenameAlias> selectEnableByDatasourceId(Integer datasourceId){
        return tablenameAliasMapper.selectEnableByDatasourceId(datasourceId);
    }

    @Override
    public int addTableAlias(List<String> tables, Integer datasourceId, String databaseNam) {
        return 0;
    }

    @Override
    public TablenameAlias selectByTablename(String tableName, Integer datasourceId) {
        return tablenameAliasMapper.selectByTablename(tableName, datasourceId);
    }


}
